<body>
    <iframe name="exportFram" id="exportFrame" src="" style="display: none;"></iframe>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <input type="hidden" name="objectId" id="objectId" value="">
            <input type="hidden" name="objectId1" id="objectId1" value="">
            <input type="hidden" name="type" id="type" value="81">
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1">
                        单据号：
                    </td>
                    <td>
                        <input type="text" name="partNumber" id="partNumber" readonly="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        经手人：
                    </td>
                    <td>
                        <input type="text" name="applyUserName" id="applyUserName" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId" value="1815">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        部门负责人：
                    </td>
                    <td>
                        <input type="text" name="approvalNames" id="approvalNames"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="approvalIds" id="approvalIds" value="568,697">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        会 计：
                    </td>
                    <td>
                        <input type="text" name="managername" id="managername"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="managerid" id="managerid" value="1704">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        会计人员名单：
                    </td>
                    <td><a style="margin-left:5px;" href="javascript:void(0);" onclick="myDownload(1)">子公司出纳清单.xls</a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        预算审核人：
                    </td>
                    <td>
                        <input type="text" name="approvalName2" id="approvalName2" readonly="">
                        <input type="hidden" name="approvalId2" id="approvalId2" value="811">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        批准人：
                    </td>
                    <td>
                        <input type="text" name="approvalName3" id="approvalName3" readonly="">
                        <input type="hidden" name="approvalId3" id="approvalId3" value="566">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        企业负责人：
                    </td>
                    <td>
                        <input type="text" name="approvalName4" id="approvalName4" readonly="">
                        <input type="hidden" name="approvalId4" id="approvalId4" value="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        财务负责人：
                    </td>
                    <td>
                        <input type="text" name="approvalName5" id="approvalName5" readonly="">
                        <input type="hidden" name="approvalId5" id="approvalId5" value="1395,574">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        凭证号：
                    </td>
                    <td>
                        <input type="text" name="voucherCode" id="voucherCode"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        预算编码：
                    </td>
                    <td>
                        <input type="text" name="code" id="code" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1" style="width:230px;">
                        费用所属部门：
                    </td>
                    <td>
                        <input type="text" name="deptName" id="deptName" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        收款人：
                    </td>
                    <td>
                        <input type="text" name="payeeName" id="payeeName" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        收款单位：
                    </td>
                    <td>
                        <input type="text" name="payCompany" id="payCompany" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        报销标准：
                    </td>
                    <td><a style="margin-left:5px;" href="javascript:void(0);" onclick="myDownload(2)">差旅管理制度.doc</a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        报销单类型：
                    </td>
                    <td>
                        <input type="text" name="rbType" id="rbType" readonly="readonly">
                    </td>
                </tr>
                <tr id="zctr">
                    <td class="tdc1"
                        title="HTTP Status 500 - Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query">
                        款项用途：
                    </td>
                    <td>
                        <input type="text" name="paymentContent" id="paymentContent"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>
                <tr id="cltr0" style="display:none">
                    <td class="tdc1">
                        出差人：
                    </td>
                    <td>
                        <input type="text" name="businessTraName" id="businessTraName"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>
                <tr id="cltr1" style="display:none">
                    <td class="tdc1">
                        起止日期：
                    </td>
                    <td>
                        <input type="text" name="startFinanceDate" id="startFinanceDate" readonly="readonly"
                            style="width:150px">
                        &nbsp;&nbsp;-&nbsp;&nbsp;
                        <input type="text" name="endFinanceDate" id="endFinanceDate" readonly="readonly"
                            style="width:150px">
                    </td>
                </tr>
                <tr id="cltr2" style="display:none">
                    <td class="tdc1">
                        出差地点：
                    </td>
                    <td>
                        <input type="text" name="address" id="address" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>
                <tr id="cltr3" style="display:none">
                    <td class="tdc1">
                        出差事由：
                    </td>
                    <td>
                        <textarea name="businessCase" id="businessCase" style="width:70%;height:70px"
                            readonly=""></textarea>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    <div id="search" class="datagrid-toolbar" style="display:none;">
        <input type="hidden" name="fid" id="fid" value="91488">
    </div>
    <div id="tools" class="datagrid-toolbar">
        <span style="margin-left:10px;" id="showhj">合计：发票张数（<font style="color:red">1</font>）&nbsp;&nbsp;&nbsp;金额（<font
                style="color:red">90000</font>）</span>
    </div>
    <div class="panel datagrid" style="width: auto;">
        <div class="datagrid-wrap panel-body panel-body-noheader" title="" style="width: 739px; height: auto;">
            <div class="datagrid-view" style="width: 739px; height: 50px;">
                <style type="text/css">
                    div.datagrid-cell-c1-paymentContent {
                        width: 192px;
                    }

                    div.datagrid-cell-c1-amount {
                        width: 142px;
                    }

                    div.datagrid-cell-c1-money {
                        width: 142px;
                    }

                    div.datagrid-cell-c1-none {
                        width: 142px;
                    }
                </style>
                <div class="datagrid-view1" style="width: 41px;">
                    <div class="datagrid-header" style="width: 41px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td rowspan="0">
                                            <div class="datagrid-header-rownumber"></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 41px; height: 25px;">
                        <div class="datagrid-body-inner">
                            <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                                <tbody>
                                    <tr id="datagrid-row-r1-1-0" datagrid-row-index="0" class="datagrid-row"
                                        style="height: 25px;">
                                        <td class="datagrid-td-rownumber">
                                            <div class="datagrid-cell-rownumber">1</div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-footer" style="width: 41px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <div class="datagrid-view2" style="width: 698px;">
                    <div class="datagrid-header" style="width: 698px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td field="paymentContent">
                                            <div class="datagrid-cell" style="width: 200px;"><span>款项用途</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="amount">
                                            <div class="datagrid-cell" style="width: 148px;"><span>发票张数</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="money">
                                            <div class="datagrid-cell" style="width: 148px;"><span>金额</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="none">
                                            <div class="datagrid-cell" style="width: 148px;"><span>附件</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 698px; height: 25px;">
                        <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                            <tbody>
                                <tr id="datagrid-row-r1-2-0" datagrid-row-index="0" class="datagrid-row"
                                    style="height: 25px;">
                                    <td field="paymentContent">
                                        <div style="height:auto;" class="datagrid-cell datagrid-cell-c1-paymentContent">
                                            启赋云平台开发-首期40%付款</div>
                                    </td>
                                    <td field="amount">
                                        <div style="height:auto;" class="datagrid-cell datagrid-cell-c1-amount">1</div>
                                    </td>
                                    <td field="money">
                                        <div style="height:auto;" class="datagrid-cell datagrid-cell-c1-money">90000
                                        </div>
                                    </td>
                                    <td field="none">
                                        <div style="height:auto;" class="datagrid-cell datagrid-cell-c1-none"><a
                                                href="javascript:viewImage(132897);">图片预览</a></div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="datagrid-footer" style="width: 698px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <table id="list_data" style="display: none;">
                </table>
            </div>
            <div class="datagrid-pager pagination">
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td><select class="pagination-page-list">
                                    <option>10</option>
                                    <option>20</option>
                                    <option>30</option>
                                    <option>40</option>
                                    <option>50</option>
                                </select></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-first">&nbsp;</span></span></span></a>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-prev">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><span style="padding-left:6px;">第</span></td>
                            <td><input class="pagination-num" type="text" value="1" size="2"></td>
                            <td><span style="padding-right:6px;">共1页</span></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-next">&nbsp;</span></span></span></a></td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-last">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-load">&nbsp;</span></span></span></a></td>
                        </tr>
                    </tbody>
                </table>
                <div class="pagination-info">显示1到1,共1记录</div>
                <div style="clear:both;"></div>
            </div>
        </div>
    </div>
    <div style="margin-left:10px;">
        <div id="showRecords">
            <div style="margin-top:8px;margin-bottom:8px;">审核人：徐艳艳<span style="margin-left:15px;">审核时间：2025-10-27
                    13:42:24</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：王维<span style="margin-left:15px;">审核时间：2025-10-28
                    15:05:40</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：王磊<span style="margin-left:15px;">审核时间：2025-10-24
                    17:51:28</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：韩威<span style="margin-left:15px;">审核时间：2025-11-03
                    10:46:43</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：凌婷婷<span style="margin-left:15px;">审核时间：2025-10-27
                    10:15:42</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：洪亚萍<span style="margin-left:15px;">审核时间：2025-10-27
                    09:44:37</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：刘新宇<span style="margin-left:15px;">审核时间：2025-11-03
                    09:54:57</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">复核人：王博宇<span style="margin-left:15px;">复核时间：2025-11-03
                    13:59:51</span><span style="margin-left:15px;">复核选项：同意</span><span
                    style="margin-left:15px;">复核意见：同意</span></div>
        </div>
    </div>


    <script>

        function checkFormMe(form) {

            return $('#my-form').form('validate');
        }

        var type = $.getUrlParam("type");

        $("#type").val(type);

        var p_id = $.getUrlParam("id");

        var objectId = new Date().getTime();
        var process_id = $.getUrlParam("processid");
        if (process_id != null) {
            $.ajax({
                type: "GET",
                url: contextPath + "manager/approvalprocess/getBeanIdByProcessId/" + process_id + "/" + type,
                data: null,
                dataType: "json",
                success: function (data) {
                    if (data && data.handleMsg.status == 1) {
                        p_id = data.id;
                        if (p_id != null) {
                            $("#commitBtn").show();
                        }
                        $("#fid").val(p_id);
                        loadBassModel(p_id);
                        loadDetails(p_id);
                        getTotal(p_id);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        } else {
            $("#commitBtn").show();
            $("#fid").val(p_id);
            loadBassModel(p_id);
            loadDetails(p_id);
            getTotal(p_id);
        }

        function loadBassModel(p_id) {
            var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/financeApproval' });
            var baseModel;
            if (p_id == null) {
                baseModel = new BaseModel();
            } else {
                baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
            }
            var baseView = new BaseView({ el: $("#my-form"), model: baseModel });
            if (p_id != null) {
                baseView.doLoad(loadMe);
            }

            function loadMe(model, response, options) {
                if (model.get("approvalProcess")) {
                    $("#applyUserName").val(model.get("approvalProcess").applyUserName);
                    $("#applyUserId").val(model.get("approvalProcess").applyUserId);
                    $("#applyDeptName").val(model.get("approvalProcess").applyDeptName);
                    $("#applyDeptId").val(model.get("approvalProcess").applyDeptId);
                    $("#type").val(model.get("approvalProcess").type);
                    $("#commitDate").val(model.get("approvalProcess").commitDate);
                }
                if (model.get("rbType") == "1") {
                    $("#rbType").val("支出凭单");
                } else {
                    $("#rbType").val("差旅费报销单");
                    $("#startFinanceDate").val(model.get("startFinanceDate").substr(0, 10));
                    $("#endFinanceDate").val(model.get("endFinanceDate").substr(0, 10));
                }
                selectRbType(model.get("rbType"));
                loadRecord(process_id);
            }
        }

        function selectRbType(value) {
            if (value == 1) {
                $("#zctr").show();
                $("#cltr0").hide();
                $("#cltr1").hide();
                $("#cltr2").hide();
                $("#cltr3").hide();
                $("#startFinanceDate").val("");
                $("#endFinanceDate").val("");
                $("#address").val("");
                $("#businessCase").val("");
            } else {
                $("#zctr").hide();
                $("#cltr0").show();
                $("#cltr1").show();
                $("#cltr2").show();
                $("#cltr3").show();
                $("#paymentContent").val("");
            }
        }

        function loadDetails(p_id) {
            $('#list_data').datagrid({
                url: contextPath + "manager/financeDetails?i=" + new Date().getTime(),
                fitColumns: true,
                singleSelect: false,
                rownumbers: true,
                pagination: true,
                sortName: 'id',
                sortOrder: 'desc',
                method: 'POST',
                onRowContextMenu: onRowContextMenu,//右键菜单
                queryParams: { "fid": p_id },
                columns: [[
                    { field: 'paymentContent', title: '款项用途', width: 200, formatter: typeRenderer },
                    { field: 'amount', title: '发票张数', width: 150 },
                    { field: 'money', title: '金额', width: 150 },
                    { field: 'none', title: '附件', width: 150, formatter: editRenderer }
                ]]
            });
        }

        function editRenderer(value, row, index) {
            var txt = "";
            txt += "<a href=\"javascript:viewImage(" + row['id'] + ");\">图片预览</a>";
            return txt;
        }

        function typeRenderer(value, row, index) {
            var txt = "";
            if (row['financeApproval'].rbType == 1) {
                txt = value;
            } else {
                var projectId = row['projectId'];
                if (projectId == 1) {
                    txt = "车船费-飞机";
                } else if (projectId == 2) {
                    txt = "车船费-火车";
                } else if (projectId == 3) {
                    txt = "车船费-轮船";
                } else if (projectId == 4) {
                    txt = "市内交通费";
                } else if (projectId == 5) {
                    txt = "住宿费";
                } else if (projectId == 6) {
                    txt = "餐费";
                } else if (projectId == 7) {
                    txt = "补助";
                }
            }
            return txt;
        }

        function viewImage(id) {
            parent.addTabs("发票预览-" + id, contextPath + "system/qdzxapproval/approval/finance_invoice_view.html?objectType=901&objectId=" + id + "&_pfrid=" + $.getUrlParam("_frid"));
        }

        function getTotal(p_id) {
            $.ajax({
                type: "POST",
                url: contextPath + "manager/financeApproval/getDetailTotalMoney/" + p_id,
                data: {},
                dataType: "json",
                success: function (data) {
                    if (data.handleMsg.status == 1) {
                        $("#showhj").html("合计：发票张数（<font style=\"color:red\">" + data.count + "</font>）&nbsp;&nbsp;&nbsp;金额（<font style=\"color:red\">" + data.totalMoney + "</font>）");
                    } else {
                        $("#errorMsg").html(data.message);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }
            });
        }

        //查询
        function query() {
            searchGo(contextPath + "manager/financeDetails?i=" + new Date().getTime(), "#search", "#list_data");
            getTotal($("#fid").val());
        }

        function myDownload(type) {
            if (type == 1) {
                $("#exportFrame").attr("src", contextPath + "system/template/子公司出纳清单.xls");
            } else if (type == 2) {
                $("#exportFrame").attr("src", contextPath + "system/template/差旅管理制度.doc");
            }
        }

        ////加载领导审核意见
        function loadRecord(process_id) {
            $.ajax({
                type: "POST",
                url: contextPath + "manager/approvalRecords/listApprovalRecord/" + process_id,
                data: {},
                dataType: "json",
                success: function (data) {
                    if (data) {
                        var rHtml = "";
                        var msg = "审核"
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].userType == 5) {
                                msg = "复核";
                            } else {
                                msg = "审核"
                            }
                            rHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + msg + "人：" + data[i].approvalUser.truename + "";
                            if (data[i].approvalDate == null) {
                                rHtml += "<span style=\"margin-left:15px;\">尚未" + msg + "</span>";
                            } else {
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "时间：" + data[i].approvalDate + "</span>";
                                if (data[i].approvalType == 1) {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：同意</span>";
                                } else {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：不同意</span>";
                                }
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "意见：" + data[i].opinion + "</span>";
                            }
                            rHtml += "</div>";
                        }
                        $("#showRecords").html(rHtml);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }
            });
        }

    </script>
    <div id="loading1"
        style="position: absolute; left: 0px; top: 0px; width: 100%; height: 703px; background: rgb(232, 232, 232); opacity: 0.5; z-index: 10000; display: none;">
    </div>
    <div id="loading2" class="panel-loading"
        style="position: fixed; top: 38%; left: 41%; border: 2px solid rgb(149, 184, 231); width: 160px; font-size: 14px; z-index: 10001; background: url(&quot;/system/jquery/themes/themes1/images/loading-1.gif&quot;) 10px 8px no-repeat rgb(255, 255, 255); display: none;">
        正在处理，请稍等...</div>
</body>